module.exports = function ($scope, $resource, toaster, $state, $modal, getDate, date2str, str2date) {
    $scope.bean = {
        // id: '',
        // top_pics_state: '',
        // class_state: '',
        // notice_state: '',
        // info_state: '',
        // active_state: '',
        // column_state: ''
    };
    console.log(window.location.host);
    $resource('/api/as/mc/shopcommon/findCommonShowInfo', {}, {}).save({}, function (res) {
        if (res.errcode == 10003) {
            toaster.info({ title: '', body: '您未设置商城信息' });
        } else if (res.errcode === 0) {
            if (res.data) {
                $scope.bean = res.data;
            }
        } else {
            toaster.error({ title: '', body: res.errmsg });
        }
    });

    //添加影院
    $scope.ok = function () {
        $resource('/api/as/mc/shopcommon/updateCommonShow', {}, {}).save($scope.bean, function (res) {
            if (res.errcode === 0) {
                toaster.success({ title: '', body: '操作成功' });
            } else {
                toaster.error({ title: '', body: res.errmsg });
            }
        });
    }

    $scope.edit = function(type) {
        console.log(type);
        var getDate1 = getDate;
        var date2str1 = date2str;
        var str2date1 = str2date;
        if (type == 'rolling') {
          // window.open('http://dlqt.tripln.com/#!/app/shangke/newsrollinglist.html/skv4');
          var modalInstance = $modal.open({
            template: require('../../45shangke/views/newsrollinglist.html'),
            controller: 'shangkenewsrollinglist',
            url: '/shangke/newsrollinglist/:type',
            size: 'lg',
            resolve: {
              'aa_type': function () {
                return 'skv4';
              }
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        } else if (type == 'class') {
          var modalInstance = $modal.open({
            template: require('../views/skwxClassList.html'),
            controller: 'skwxClassList',
            url: '/skwx/skwxClassList',
            size: 'lg',
            resolve: {
            
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        } else if (type == 'column') {
          var modalInstance = $modal.open({
            template: require('../views/skwxColumnList.html'),
            controller: 'skwxColumnList',
            url: '/skwx/skwxColumnList',
            size: 'lg',
            resolve: {
              
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        } else if (type == 'kkz') {
          var modalInstance = $modal.open({
            template: require('../views/headline.html'),
            controller: 'headline',
            url: '/skwx/headline/:type',
            size: 'lg',
            resolve: {
              'aa_type': function () {
                return '1';
              }
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        } else if (type == 'bargain') {
          var modalInstance = $modal.open({
            template: require('../../49shangkeexpand/views/newprizelist.html'),
            controller: 'newprizelist',
            url: '/shangkeexpand/newprizelist',
            size: 'lg',
            resolve: {
                'getDate': function () {
                  return getDate1;
                },
                'date2str': function () {
                  return date2str1;
                },
                'str2date': function () {
                  return str2date1;
                },
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        } else if (type == 'xsg') {
          var modalInstance = $modal.open({
            template: require('../views/skwxShopFlashsale.html'),
            controller: 'skwxShopFlashsale',
            url: '/skwx/skwxShopFlashsale',
            size: 'lg',
            resolve: {
                
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        }  else if (type == 'hkd') {
          var modalInstance = $modal.open({
            template: require('../views/discountcards.html'),
            controller: 'discountcards',
            url: '/skwx/discountcardsproduct',
            size: 'lg',
            resolve: {
                
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        } else if (type == 'ym') {
          var modalInstance = $modal.open({
            template: require('../views/voluntaryactproduct.html'),
            controller: 'voluntaryactproduct',
            url: '/skwx/voluntaryactproduct',
            size: 'lg',
            resolve: {
                
            }
          });
  
          modalInstance.opened.then(function () {// 模态窗口打开之后执行的函数  
          });
          modalInstance.result.then(function (showResult) {
          }, function (reason) {
          });
        }
    }
    

};